//
//  OrderProductDetailCell.m
//  sensen_ios
//
//  Created by mc on 16/2/27.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "OrderProductDetailCell.h"

@implementation OrderProductDetailCell

+(instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString * cellIdentifier = @"OrderProductDetailCell";
    OrderProductDetailCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell ==nil) {
        cell = [[self alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
    
}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        [self setupSubViews];
        
    }
    return self;
}
- (void)setupSubViews{
       self.ivContent = [[UIImageView alloc] init];
    [self.ivContent setBackgroundColor:[UIColor redColor]];
    [self addSubview:self.ivContent];
    [self.ivContent mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(10);
        make.top.equalTo(self.mas_top).offset(5);
        make.size.mas_equalTo(CGSizeMake(50, 50));
        
    }];
    
    
    self.lblTitle = [[UILabel alloc] init];
    [self addSubview:self.lblTitle];
    [self.lblTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.ivContent.mas_right).offset(10);
        make.right.equalTo(self).offset(-120);
        make.top.equalTo(self.ivContent.mas_top).offset(0);
        make.height.equalTo(@13);
    }];
    self.lblTitle.font = [UIFont systemFontOfSize:12];
    self.lblTitle.numberOfLines = 0;
    
    
    
    self.lblCount = [[UILabel alloc] init];
    [self addSubview:self.lblCount];
    [self.lblCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-10);
        make.bottom.equalTo(self.ivContent.mas_bottom).offset(0);
        make.size.mas_equalTo(CGSizeMake(50, 15));
        
    }];
    self.lblCount.font =[UIFont systemFontOfSize:12];
    self.lblCount.textAlignment = NSTextAlignmentRight;
    
    self.lblBrand = [[UILabel alloc] init];
    [self addSubview:self.lblBrand];
    [self.lblBrand mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.lblTitle.mas_left).offset(0);
        make.top.equalTo(self.lblTitle.mas_bottom).offset(2);
        make.height.equalTo(@13);
        make.right.equalTo(self).offset(-120);
        
    }];
    self.lblBrand.font = [UIFont systemFontOfSize:12];
    
    
    self.lblPrice = [[UILabel alloc] init];
    [self addSubview:self.lblPrice];
    [self.lblPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.ivContent.mas_right).offset(10);
        make.bottom.equalTo(self.ivContent.mas_bottom).offset(0);
        make.size.mas_equalTo(CGSizeMake(100, 20));
    }];
    self.lblPrice.textAlignment = NSTextAlignmentLeft;
    self.lblPrice.font = [UIFont systemFontOfSize:16];
    
    
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    [self addSubview:self.button];
    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-10);
        make.bottom.equalTo(self).offset(-5);
        make.size.mas_equalTo(CGSizeMake(50, 30));

    }];
    
    self.button.backgroundColor = SS_NAVI_ORANGE_COLOR;
    [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    
    self.lblTitle.textColor = [UIColor darkGrayColor];;
    self.lblBrand.textColor = [UIColor darkGrayColor];;
    self.lblCount.textColor = [UIColor darkGrayColor];;
    self.lblPrice.textColor = [UIColor redColor];
    
    
    
    
}

@end
